@extends('admin.public.master')
@section('content')
    <div class="content-wrapper">
        <div class="content-wrapper-before"></div>
        <div class="content-header row">
            <div class="content-header-left col-md-1 col-4 mb-2">
                <a href=""><h5 class="content-header-title">货品列表</h5></a>
            </div>
            <div class="content-header-left col-md-1 col-4 mb-2">
                <a href=""><h5 class="content-header-title">添加货品</h5></a>
            </div>
        </div>
    </div>
            <form action="{{route('goods.product.update',['product'=>$product,'goods'=>$goods->id])}}" method="post">
                @csrf @method('PUT')
                <div class="content-body">
                    <div class="card mt-2">
                        @foreach($attributes as $attribute)
                            <div class="row ml-2 mt-1">
                                <div class="col-6">
                                    <div class="form-group">
                                        <label for="">{{$attribute->name}}
                                        </label>
                                        <select class="form-control" name="attributeArr[]" id="">
                                            @foreach($attribute->attributeSon as $value)
                                                <option {{in_array($value->id,$attrIdArr)?'selected':''}} value="{{$value->id}}">{{$value->name}}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>
                            </div>
                        @endforeach
                        <div class="row ml-2 mt-1">
                            <div class="col-6">
                                <div class="form-group">
                                    <label for="">附加价格</label>
                                    <input type="text" name="extraPrice" value="{{$product->extraPrice}}" class="form-control" placeholder="" aria-describedby="helpId">
                                </div>
                            </div>
                        </div>
                        <div class="row ml-2 mt-1">
                            <div class="col-6">
                                <div class="form-group">
                                    <label for="">库存</label>
                                    <input type="text" name="inventory" value="{{$product->inventory}}" class="form-control" placeholder="" aria-describedby="helpId">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="card-footer text-muted">
                        <button type="submit" class="btn btn-glow btn-bg-gradient-x-red-pink mt-1 ml-5 mb-2">保存货品</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    @endsection
